<?php
  class memcacheclass {
  private $memcache;
  function connect() {
  
  $this->memcache= new Memcache;
  $this->memcache->connect('localhost', 11211) or die ("Could not connect Memcache");
  
  }
  
  function set($key,$tmp_object)
  {
  if (!defined('timecache')) {
    $timecache=20;
  }else
  {
  
    $timecache=timecache;
  }
  $this->memcache->set(baseinfo.''.str_replace(array("\r","\n",'\r','\n'),'',$key), $tmp_object, false, $timecache) or die ("Failed to save data at the server");
  
  
  }
  
  function get($key)
  {
   $get_result = $this->memcache->get(baseinfo.''.str_replace(array("\r","\n",'\r','\n'),'',$key));
   
    if(count($get_result)&&is_array($get_result))
    {
    
    return $get_result;
    }else
    {
    
    return array();
    }
  
  }
  
  }
?>
